<?php
/**
**鼓浪屿轮渡对接天猫
**购买当天当前时间有座位的航班
**接收数据只有pid
**User By Pzp
**Time 2015-09-25 pm
**/
include('/var/www/html/new/d/module/api/glyld/glyld.class.php');
if (!class_exists("go_sql")){
	include("/var/www/html/new/conf/le.je");
	$le=new go_sql();
	$le->connect();
}

$pid = $_REQUEST['pid'] + 0;

$select_uuid = "select uuid,id,landid from uu_jq_ticket where pid='$pid' limit 1";
$GLOBALS['le']->query($select_uuid);
if(!$GLOBALS['le']->fetch_assoc())	exit('101');
$uuids = explode("_",$GLOBALS['le']->f('uuid'));  //查询票类id
$hlineid = $uuids[0]; //航线id 
$sdate = date('Ymd');

$gly = new Ferry_gly(); 
$getDailyFlight = $gly->getDailyFlight($hlineid,$sdate);
if($getDailyFlight == 105) exit("105");
$getDailyFlight = simplexml_load_string($getDailyFlight);
if((int)$getDailyFlight->code == 0){	
	$list = array();
	foreach($getDailyFlight->content->list->DailyFlight as $list3){
			$list[] = $list3;				
	}
}
$postdata = $list[1];
if($postdata){
	$return = array(
		'flight' => (string)$postdata->dailyFlightGid,
		'kctime' => substr((string)$postdata->departTime,11,7)
	);
	print_r(json_encode($return));
}else exit("105");
?>